package com.lxs.spring6.boot3.kafka;

import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Service;

/**
 * kafka消费者
 */
@Service
public class KafkaConsumer {

    /**
     * 监听 my-topic 主题并接收消息
     * @param message
     */
    @KafkaListener(topics = "my-topic", groupId = "my-group-id")
    public void consume(String message) {
        System.out.println("Received message: " + message);
    }

}